package com.seckill.common.error;

import com.seckill.common.error.CommonError;

public enum BusinessError implements CommonError {
    // 0000开头，int类型会被默认处理成个位数字
    // 通用错误类型——1000开头
    PARAMETER_VALIDATION_ERROR(10001, "参数不合法！"),
    UNKNOWN_ERROR(10002, "未知错误！"),

    // 用户相关错误类型--2000开头
    USER_NOT_EXIST(20001, "用户不存在");

    private int errorCode;
    private String errorMsg;

    private BusinessError(int errorCode, String errorMsg) {
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    @Override
    public int getErrorCode() {
        return this.errorCode;
    }

    @Override
    public String getErrorMsg() {
        return this.errorMsg;
    }

    @Override
    public CommonError setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
        return this;
    }
}
